/**
* 贷后管理路由
**/
'use strict';
import tissueCtl from './tissue'

import bumenCtl from './bumen'

import positionCtl from './position'//职位
import loanappCtl from './loanapp'//
import historylogCtl from './historylog'//
import creditCtl from './credit'//征信查询
import historyCtl from './history'//征信查询历史

module.exports = angular.module('app.operation', []).config(function($stateProvider) {
    $stateProvider.state('operation', {
        url: '/operation',
        templateProvider: function($q) {
            var deferred = $q.defer();
            require.ensure(['../layout.html'], function(require) {
                var template = require('../layout.html');
                deferred.resolve(template);
            }, 'operation-tpl');
            return deferred.promise;
        },
        controller: 'operationCtrl',
        controllerAs: 'vm',
        resolve: {
            'app.operation': function($q, $ocLazyLoad) {
                var deferred = $q.defer();
                require.ensure(['./index.js'], function() {
                    var mod = require('./index.js');
                    $ocLazyLoad.load({
                        name: 'app.operation'
                    });
                    deferred.resolve(mod.controller);
                }, 'operation-ctl');
                return deferred.promise;
            }
        }
    })
    .state('operation.tissue', {
        url: '/tissue',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./tissue/index.html'], function(require) {
                        var template = require('./tissue/index.html');
                        deferred.resolve(template);
                    }, 'operation.tissue-tpl');
                    return deferred.promise;
                },
                controller:tissueCtl
            }
        }
    })
    .state('operation.position', {
        url: '/tissue/position',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./position/index.html'], function(require) {
                        var template = require('./position/index.html');
                        deferred.resolve(template);
                    }, 'operation.position-tpl');
                    return deferred.promise;
                },
                controller:positionCtl
            }
        }
    })
    .state('operation.bumen', {
        url: '/tissue/bumen',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./bumen/index.html'], function(require) {
                        var template = require('./bumen/index.html');
                        deferred.resolve(template);
                    }, 'operation.bumen-tpl');
                    return deferred.promise;
                },
                controller:bumenCtl
            }
        }
    })
    .state('operation.loanapp', {
        url: '/loanapp?state?id',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./loanapp/index.html'], function(require) {
                        var template = require('./loanapp/index.html');
                        deferred.resolve(template);
                    }, 'operation.loanapp-tpl');
                    return deferred.promise;
                },
                controller:loanappCtl
            }
        }
    })
    .state('operation.historylog', {
        url: '/loanapp/historylog?id',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./historylog/index.html'], function(require) {
                        var template = require('./historylog/index.html');
                        deferred.resolve(template);
                    }, 'operation.historylog-tpl');
                    return deferred.promise;
                },
                controller:historylogCtl
            }
        }
    })
    .state('operation.credit', {
        url: '/credit',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./credit/index.html'], function(require) {
                        var template = require('./credit/index.html');
                        deferred.resolve(template);
                    }, 'operation.credit-tpl');
                    return deferred.promise;
                },
                controller:creditCtl
            }
        }
    })
    .state('operation.history', {
        url: '/credit/history',
        views: {
            'content': {
                templateProvider: function($q) {
                    var deferred = $q.defer();
                    require.ensure(['./history/index.html'], function(require) {
                        var template = require('./history/index.html');
                        deferred.resolve(template);
                    }, 'operation.history-tpl');
                    return deferred.promise;
                },
                controller:historyCtl
            }
        }
    })
}).name;
